package gx.dao.common;


import java.io.Serializable;
import java.util.List;

import org.hibernate.Session;

import gx.entity.common.Page;


/**
 * 基于泛型的通用Dao接口，声明了基本的CRUD操作
 * @param <T>
 */
public interface BaseDao<T> {
	public Session getSession();
	
	public void save(T entity);

	public void update(T entity);

	public void delete(T entity);

	public void delete(Serializable id);

	public T get(Serializable id);

	public T load(Serializable id);

	public long total();
	
	public long total(String hql, Object... values);

	public List<T> findAll();

	public List<T> findAll(String orderByProperty, boolean desc);

	public Page<T> findByPager(int pageSize, int pageNo);

	public Page<T> findByPager(int pageSize, int pageNo, String orderByProperty, boolean desc);

	public List<T> find(String hql, Object... values);

	public Page<T> find(int pageSize, int pageNo, String hql, Object... values);

	public T findUniqueResult(String hql, Object... values);

	public int batchExecute(String hql, Object... values);

	public List<T> getBatch(Serializable... ids);
	
	public void batchDelete(Serializable... id);
}